<template>
	<!-- <view :class="showscrollY?'he100 pages':'pages'"> -->
	<view >
		<view class="status-bar" v-if="isShowStatusBar"></view>
		<view class="top">
			<!-- <image  src="../../static/shouye/newHome/bg10.png" width="100%" class="bgtou" mode=""></image> -->
			<view class="status_bar"></view>
			<view class="title">
				<view  class="left">
					<image class="left" @click="kefu('/pages/other/kefu/kefu')" src="../../static/cut/2222.png" mode=""></image>
					<text v-if="unread_msg_count">{{unread_msg_count}}</text>
				</view>
				<!-- <image class="right" @click="sign" src="../../static/cut/1111.png" mode=""></image> -->
			</view>
			<view>
				<view class="duobianxing">
				</view>
					<view @click="goapgece" class="yuan" style="overflow: hidden;">
						<view class="shuiqiu">
						    <view class="shuiqiucontent">
						        <view class="shui shui2" :class="{'red': CompanyPoint < 60, 'blue': CompanyPoint > 80, 'yellow': CompanyPoint >= 60 && CompanyPoint <= 80}" :style="{top: bollTopPx}"></view>
						        <view class="shui shui3" :class="{'red': CompanyPoint < 60, 'blue': CompanyPoint > 80, 'yellow': CompanyPoint >= 60 && CompanyPoint <= 80}" :style="{top: bollTopPx}"></view>
						        <view class="shui shui4" :class="{'red': CompanyPoint < 60, 'blue': CompanyPoint > 80, 'yellow': CompanyPoint >= 60 && CompanyPoint <= 80}" :style="{top: bollTopPx}"></view>
						        <view class="shui shui1" :class="{'red': CompanyPoint < 60, 'blue': CompanyPoint > 80, 'yellow': CompanyPoint >= 60 && CompanyPoint <= 80}" :style="{top: bollTopPx}"></view>
						        <view class="shui shui5" :class="{'red': CompanyPoint < 60, 'blue': CompanyPoint > 80, 'yellow': CompanyPoint >= 60 && CompanyPoint <= 80}" :style="{top: bollTopPx}"></view>
						        <view class="shui shui6" :class="{'red': CompanyPoint < 60, 'blue': CompanyPoint > 80, 'yellow': CompanyPoint >= 60 && CompanyPoint <= 80}" :style="{top: bollTopPx}"></view>
						    </view>
						</view>
						<view class="num" style="position: absolute;top: -5px;">{{ CompanyScore }}</view>
						
					</view>
					<view class="fen0">分</view>
				<view class="fen">安全防护</view>
				<view class="fen1">企业防护</view>
				<view class="fen2">环境防护</view>
				<view class="zi"><text>企业健康指数</text></view>
				
			</view>
			
			<view id='waveEchart' ref='waveEchart' ></view>
		</view>
		<view class="card second">
			<view class="second">
				<swiper :indicator-dots="false" :autoplay="false" @change="changeSwiper">
					<swiper-item>
						<view class="swiper-item">
							<view @click="goapge('/pages/huihuandeweizhi/dangerHandle')">
								<view class="h60">
									<image src="../../static/shouye/newHome/gongjuku.png" mode="" style="width:70upx;height:70upx"></image>
								</view>
								<view class="text">隐患治理</view>
								<!-- <text class="num" v-if="records!=0">{{records}}</text> -->
							</view>
							<view @click="scanCode">
								<view class="h60">
								<image src="../../static/shouye/newHome/saoyisao.png" mode="" style="width:70upx;height:70upx"></image>
								</view>
								<view class="text">扫一扫</view>
							</view>
							<view  @click="scanCode2">
								<view class="h60">
								<image src="../../static/shouye/newHome/suishoupai.png" mode="" style="width:70upx;height:70upx"></image>
								</view>
								<view class="text">任务提醒</view>
							</view>
							<view  @click="goapge('/pages/riskEvaluation/riskAlarm')">
								<view class="h60">
									<image src="../../static/shouye/newHome/yujing.png" mode="" style="width:70upx;height:70upx"></image>
									<view class="tag" v-if="messages">{{ messages }}</view>
								</view>
								<view class="text">预警提醒</view>
							</view>
						</view>
					</swiper-item>
					<!-- <swiper-item>
						<view class="swiper-item">
							<view  @click="scanCode2">
								<view class="h60">
									<image src="../../static/cut/5555.png" mode="" style="width:54upx;height:60upx"></image>
								</view>
								<view class="text">随手拍</view>
							</view>
							<view  @click="goapge('/pages/huihuandeweizhi/fengxianyujing')">
								<view class="h60">
								<image src="../../static/cut/6666.png" mode="" style="width:50upx;height:60upx"></image>
								</view>
								<view class="text">企业预警</view>
							</view>
						</view>
					</swiper-item> -->
				</swiper>
			</view>
			
			<view class="indicatorDots">
				<view :class="current==0?'active Dot':'Dot'"></view>
				<!-- <view :class="current==1?'active Dot':'Dot'"></view> -->
			</view>
		</view>
		<view class="card" style="position: relative;top:-150upx;padding: 20upx 0 20upx 0;">
			<view @click="toPage('../riskEvaluation/riskTask')" class="daiban">
				<image class="hu" src="../../static/cut/9999.png" mode=""></image>
				
				<!-- <image class="hu2" src="../../static/cut/1010.png" mode=""></image> -->
				<view class="shixiang">
					<text style="font-size: 24upx;width: 150upx;position: relative;top:15rpx;z-index: 4;">待办事项</text>
					<swiper :autoplay="warningSwiper.autoplay" :circular="warningSwiper.circular" :vertical="warningSwiper.vertical" :display-multiple-items="warningSwiper.multi">
						<swiper-item v-for="(item,index) in recordslist" :key="item.id">· {{item.title}}</swiper-item>
					</swiper>
				</view>
				<image class="daiban_letfmore" src="../../static/shouye/newHome/gengduo2.png" mode=""></image>
			</view>
		</view>
		<view class="card" style="position: relative;top:-150upx;">
			<view @click="toPage('../news/today')" class="weiTitle" :class="{fixed: isFixNewsTitle}">
				<text>资讯</text>
				<image src="../../static/cut/20191123232532.png" mode="" style="margin-right: 40upx;"></image>
			</view>
			<view class="row" style="height: 100%;">
				<view class="list" v-for="(item,index) in newlist" :key="item.id"  @click="goDetail(item)">
					<image :src="baseURL+item.pic_utl" mode=""></image>
					<view class="newCont">
						<view class="newTitle">{{item.title}}</view>
						<view class="newD">{{item.title}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="tanc" v-show="tancshow">
			<view class="mark" @click="showtanc"></view>
			<view class="tigBox">
				<image src="../../static/cut/loginHT.png" mode=""></image>
				<view class="kuang">
					<view>
						<view>1.是否增加员工账号？</view>
						<view>2.增加员工账号可以完善企业信息。</view>
						<view>3.不选择可自行完善企业信息。</view>
					</view>
				</view>
				<view class='btns'>
					<image src="../../static/cut/2.png" @click="showtanc" mode=""></image>
					<image src="../../static/cut/1.png" @click="register2" mode=""></image>
				</view>
			</view>
		</view>
		<scroll-view :scroll-top="scrollTop" scroll-y="true" :class="showscrollY?'show scroll-Y':hidescrollY?'hide scroll-Y':'scroll-Y'" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
			<view class="scroll-Y-page">
				<view class="status_bar"></view>
				<view class="search">
					<image class="back" @click="hidecrollY" src="../../static/cut/left.png" mode=""></image>
					<view class="searchBox" @click="goapge('/pages/news/newsSearch')">
						<image src="../../static/zixun/3.png" mode=""></image>
						<text>搜索你感兴趣的内容</text>
					</view>
				</view>
				<view class="scrollbox">
					<scroll-view id="tab-bar" class="uni-swiper-tab" scroll-x :scroll-left="scrollLeft">
						<view v-for="(tab,index) in tabBars" :key="tab.id" :class="['swiper-tab-list',tabIndex==index ? 'active' : '']" :id="'top'+tab.id"
						 :data-current="index" @click="tapTab(index,tab.id)">{{tab.name}}</view>
					</scroll-view>
				</view>
				<swiper :indicator-dots="false" :autoplay="true" :interval="3000" :duration="1000" @change="changeZXSwiper">
					<swiper-item v-for="(item,index) in IndexLunboArr" :key='index'>
						<view class="swiper-item" @click="Lunbogo(item)">
							<image :src="baseURL+item.url" mode=""></image>
						</view>
					</swiper-item>
				</swiper>
				<view class="indicatorDots">
					<view class="indicatorDotList" v-for="(item,index) in IndexLunboArr" :key='index'>
						<image :src="ZXSwiper==index?'/static/zixun/1.png':'/static/zixun/2.png'"  mode=""></image>
					</view>
				</view>
				
				<view class="news">
					<view class="list"  v-for="(item,index) in newspagelist" :key='item.id'>
						<!-- 只有一张图张图 -->
						<view class="listleft" @click="goDetail(item)">
							<view class="news_title">{{item.title}}</view>
							<view class="from">
								<view class="fromtext">来源：{{item.auth}}·{{item.publish_time}}</view>
								<text v-if="item.is_top==1" class="toptip">置顶</text>
								<text v-else class="sc">{{item.stored}}人收藏</text>
							</view>
						</view>
						<image :src="baseURL+item.pic_utl" mode=""></image>
					</view>
					<!--只有三张图 
					<view class="list">
						<view class="listleft hasimage">
							<view class="news_title">安监 | 打造全国首家公共应急频道 </view>
							<view class="image">
								<image src="../../static/1509161490928274.jpg" mode=""></image>
								<image src="../../static/1509161490928274.jpg" mode=""></image>
								<image src="../../static/1509161490928274.jpg" mode=""></image>
							</view>
						</view>
					</view> -->
				</view>
			</view>
		</scroll-view>
		<!-- 支付弹窗 -->
		<view class="cgts" v-if="showSuccess">
			<view>
				<uni-icons :type="'close'" :size="'30'" @click="showSuccess=false" class="close"></uni-icons>
				<text>您现在不能查看，需要提升会员等级或者单独购买！</text>
				<view class="buts">
					<button type="primary" @click="pay">￥{{price}}</button>
					<button type="primary" @click="chargeVip">提升会员</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import uniIcons from '@/components/uni-icons/uni-icons.vue'
	var bitmap = null;
	const MIN_SCORE  = 0;		// 最低分 0分
	const FULL_SCORE = 126;		// 满分时的最大TOP
	const TIMER_SCICLE = 20;	// 循环的时间，30毫秒
	export default {
		components: {
			uniIcons
		},
		data() {
			return {
				baseURL:this.$API.baseURL,
				account:'',//用户电话
				messages: 0,
				unread_msg_count:0,//用户现在未读消息的条数
				isFixNewsTitle: false,
				isShowStatusBar: false,
				currentNewsPage: 1,
				current:0,
				records:0,
				recordslist:[],
				tancshow:false,
				scrollTop:0,
				old: {
					scrollTop: 0
				},
				//首页底部固定的条数
				newlist:[],
				
				/*轮播*/
				IndexLunboArr:[],
				//企业健康指数
				CompanyPoint: 0,
				CompanyScore: 0,
				bollTop: FULL_SCORE,
				bollTopPx: '126px',
				bollTopTimer: null,
				//显示咨询
				showscrollY:false,
				//是否为出发隐藏咨询
				hidescrollY:false,
				//资讯轮播当前
				ZXSwiper:0,
				//咨询分类列表
				tabBars: [],
				page:1,
				rows:10,
				scrollLeft: 0,
				tabIndex: -1,//咨询列表第一次不选中
				newspagelist:[],
				
				// 预警事项
				warningSwiper: {
					autoplay: true,
					circular: true,
					vertical: true,
					multi: 2
				},
				
				// 支付弹窗
				showSuccess:false,
				price:0,
				newsid:''
			};
		},
		onLoad() {
			this.list();
			this.findCompanyInfo();
			// #ifdef APP-PLUS
				bitmap = new plus.nativeObj.Bitmap('bmp1');
				bitmap.loadBase64Data('', function() {}, function(e) {})
			// #endif
			// 进入时判断用户是否登录
			if(!uni.getStorageSync("userid")||!uni.getStorageSync("deptid")||!uni.getStorageSync("phone")){
				uni.redirectTo({
					url:"../login/login"
				})
			}else{
				// 登录聊天
				var _this = this;
				_this.account = uni.getStorageSync('phone');
				// console.log(_this.$appjs.jim.isInit())
				// if(!_this.$appjs.jim.isInit()){
				// 	_this.$appjs.jimInit;
				// }
				//IM是否登录
				if(_this.$appjs.jim.isLogin()){
					console.log('isLogin')
					_this.getConversation();
				}else{
					var time = setInterval(function(){
						// console.log('setInterval',_this.$appjs.jim.isConnect(),_this.$appjs.jim.isInit())
						//IM是否初始化，链接是否成功
						if(_this.$appjs.jim.isConnect()&&_this.$appjs.jim.isInit()){
							var phone = uni.getStorageSync('phone')
							//登陆IM
							_this.$appjs.jim.login({
								'username' : _this.account,
								'password': '123456'
							}).onSuccess(function(e){
								// console.log('登陆成功',JSON.stringify(e))
								_this.getConversation();
								_this.onMsgReceive();
								setTimeout(function() {
									uni.setStorageSync("phone",phone);
								},3000);
								_this.$appjs.jim.onEventNotification(function(data) {
									_this.downline();
									uni.showModal({
										title: '提示',
										content: '账号在已在别处登录',
										showCancel:false,
										success: res => {
											plus.runtime.quit();
										},
									});
								});
							}).onFail(function(e){
								setTimeout(function() {
									uni.setStorageSync("phone",phone);
								},3000);
								console.log('登陆失败',JSON.stringify(e))
							})
							clearInterval(time);
						}
					},500)
				}
			}
		},
		onHide() {
			// #ifdef APP-PLUS
			/* 隐藏凸起图标 */
			var icon = plus.nativeObj.View.getViewById("icon");
			setTimeout(function() {
				if(icon){icon.hide();}
			}, 100);
			// #endif
			
			clearInterval(this.bollTopTimer);
			this.bollTop = FULL_SCORE;
			this.bollTopPx = `${this.bollTop}px`;
			this.CompanyScore = MIN_SCORE;
		},
		onShow() {
			// #ifdef APP-PLUS
			var icon = plus.nativeObj.View.getViewById("icon");
			setTimeout(function() {
				if(icon){icon.show();}
			}, 100);
			// #endif
			this.listByUser();
			// this.getIndexLunbo();
			this.getCompanyPoint();
			this.lists_detail();
			
			
			if(this.$appjs.jim.isLogin()){
				this.onMsgReceive();
				this.getConversation();
			}
		},
		onReachBottom(){
			// var _this = this;
			// setTimeout(function() {
			// 	_this.showscrollY = true;
			// }, 800);
			this.currentNewsPage++;
			this.lists_detail();
		},
		onPageScroll(res){
			this.isFixNewsTitle = res.scrollTop >= 400;
			this.isShowStatusBar = res.scrollTop >= 200;
		},
		methods:{
			toPage(url){
				uni.navigateTo({url})
			},
			//会话的消息提示监听
			onMsgReceive(){
				var _this = this;
				_this.$appjs.jim.onMsgReceive(function(data) {
					uni.vibrateLong();
					
					const innerAudioContext = uni.createInnerAudioContext();
					innerAudioContext.autoplay = true;
					innerAudioContext.src = '/static/thebell/dingding.mp3';
					innerAudioContext.onPlay(() => {
					  console.log('开始播放');
					});
					innerAudioContext.onError((res) => {
					  console.log(res.errMsg);
					  console.log(res.errCode);
					});
					_this.getConversation();
				});
			},
			//获取会话列表  --- 获取消息的条数
			getConversation(){
				var _this = this;
				_this.$appjs.jim.getConversation().onSuccess(function(data) {
					_this.unread_msg_count = 0;
					data.conversations.forEach(function(v,i){
						_this.unread_msg_count = _this.unread_msg_count + v.unread_msg_count 
					})
					if(_this.unread_msg_count>99){
						_this.unread_msg_count = 99 + '+'
					}
				})
			},
			// 得分水球
			setWaterBoll(){
				// 设置动态水球
				let toTop = FULL_SCORE - (this.CompanyPoint * (FULL_SCORE / 100));
				this.bollTopPx = `${toTop}px`;
				this.CompanyScore = this.CompanyPoint;
				return;
				
				
				this.bollTopTimer = setInterval(()=>{
					if(this.bollTop <= toTop){
						return clearInterval(this.bollTopTimer);
					}
					this.bollTop--;
					this.bollTopPx = `${this.bollTop}px`;
				}, TIMER_SCICLE - 10);
				
				// 设置动态分数
				let bollScoreTimer = setInterval(()=>{
					if(this.CompanyScore >= this.CompanyPoint){
						return clearInterval(bollScoreTimer);
					}
					this.CompanyScore++;
				}, TIMER_SCICLE);
			},
			//创建底部导航中间的圆形
			createtab: function(){
				// 设置水平居中位置
				var leftPos = Math.ceil((plus.screen.resolutionWidth - 50) / 2);
				var view = plus.nativeObj.View.getViewById("icon");
				if(!view){
					view = new plus.nativeObj.View('icon', {
						bottom: '20px',
						left: leftPos + 'px',
						width: '55px',
						height: '55px'
					});
				}
				var backgrdColor = '#c8153f';
				this.CompanyPoint<60?backgrdColor='#c8153f': (this.CompanyPoint<80?backgrdColor='#ffd300':backgrdColor= '#368ce6')
				
				view.drawRect({color:'#ffffff',radius:'55px'});
				view.drawRect({color:'rgba(0,0,0,0)',borderColor:'#bfbfbf',borderWidth:'0.5px',radius:'55px'},{top:'0px',left:'0px',width:'100%',height:'100%'});
				view.drawRect({color:'#ffffff'},{top:'25px',left:'0',width:'55px',height:'30px'});
				view.drawRect({color:backgrdColor,radius:'43px'},{top:'6px',left:'6px',width:'43px',height:'43px'});
				view.drawText(this.CompanyPoint, {top:'0px',left:'0px',width:'100%',height:'100%'},{align:'center','size':'28px','color':'#fff'});
				
				// view.drawBitmap(bitmap, {
				// 	tag: 'font',
				// 	id: 'icon',
				// 	src: '/static/app-tabber/app-tabber.png',
				// 	position: {
				// 		top: '0px',
				// 		left: '5px',
				// 		width: '50px',
				// 		height: '100%'
				// 	}
				// });
				view.addEventListener("click", function(e) {
					uni.switchTab({
						url: '/pages/riskEvaluation/fengxianpingce'
					})
				}, false);
				view.show();
			},
			//跳转到购买会员
			chargeVip(){
				uni.navigateTo({
					url:"/pages/newpages/vip"
				})
			},
			//跳转详情页面
			goDetail(e) {
				this.price = e.price;
				this.newsid = e.id;
				
				
				var _this = this;
				if(uni.getStorageSync("vip_status") < e.need_vip){
					//检查是否购买了该文章
					uni.request({
						url:this.$API.isBuy,
						method:"GET",
						data:{
							userid:uni.getStorageSync("userid"),
							newsid:_this.newsid,
							type:'news'
						},
						header:this.$API.get_head(),
						success: (res) => {
							if(res.data){
								_this.showSuccess = false;
								uni.navigateTo({
									url: '/pages/news/list2detail-detail?data=' + _this.newsid
								})
							}else{
								_this.showSuccess = true;
							}
						},
						fail: () => {
							uni.showToast({
								title:"加载失败",
								icon:'none'
							})
						}
					})
					return false;
				}
				uni.navigateTo({
					url: '/pages/news/list2detail-detail?data=' + _this.newsid
				})
			},
			//立即购买文章
			pay() {//获取支付信息
				let _this = this;
					uni.request({
						url: this.$API.wxpay,
						method:"GET",
						data: {
							pay_price: parseInt(this.price * 100),
						},
						success: (result) => {
							var orderInfo = result;
							if (orderInfo.statusCode != 200) {
								uni.showModal({
									content: "获得订单信息失败",
									showCancel: false
								})
								return;
							}
							uni.requestPayment({
								provider: 'wxpay',
								orderInfo: orderInfo.data,
								success: (e) => {
									uni.showModal({
										content: "支付成功",
										showCancel: false,
										success() {
											_this.buyNews();
										}
									});
									
								},
								fail: (e) => {
									uni.showModal({
										content: "支付失败",
										showCancel: false
									})
								},
								complete: () => {
									
								}
							})
						},
						fail: (e) => {
							// res(result)
						}
					})
			},
			//支付之后录入
			buyNews(){
				var _this = this;
				uni.request({
					url:this.$API.isBuy,
					method:"GET",
					data:{
						userid:uni.getStorageSync("userid"),
						newsid:this.newsid,
						type:'news'
					},
					header:this.$API.get_head(),
					success: (res) => {
						if(res.data){
							_this.showSuccess = false;
							// uni.navigateTo({
							// 	url: '/pages/news/list2detail-detail?data=' + e
							// })
						}else{
							_this.showSuccess = true;
						}
					},
					fail: () => {
						uni.showToast({
							title:"加载失败",
							icon:'none'
						})
					}
				})
			},
			//资讯轮播改变
			changeZXSwiper(e){
				this.ZXSwiper = e.detail.current
			},
			//隐藏咨询页面
			hidecrollY(){
				this.hidescrollY = true;
				this.showscrollY = false;
			},
			//首页底部固定的条数
			lists_detail() {
				var _this = this;
				uni.request({
					url: this.$API.ttNews_list,
					method: "GET",
					data: {
						page: _this.currentNewsPage,
						rows: 10,
						sort : "is_top desc,publish_time",
						order : "desc",
						where:{status:1}
					},
					header: this.$API.get_head(),
					success: (res) => {
						// 判断是分页加载还是首次加载
						if(_this.currentNewsPage == 1){
							_this.newlist = res.data.rows;
						}else{
							_this.newlist = _this.newlist.concat(res.data.rows);
						}
					},
					fail: () => {
						uni.showToast({
							title: "加载失败",
							icon: 'none'
						})
					}
				})
			},
			//企业健康指数
			getCompanyPoint(){
				var _this = this;
				
				// 异步获取远端数据
				uni.request({
					url:this.$API.getCompanyPoint,
					method:"POST",
					data:{
						userid:uni.getStorageSync("userid"),
						company:uni.getStorageSync("company")
					},
					header:this.$API.get_head(),
					success: (res) => {
						_this.messages = res.data.msg
						_this.CompanyPoint = res.data.point;
						_this.setWaterBoll();
						
						// #ifdef APP-PLUS
							_this.createtab();
						// #endif
						
					},
					fail: () => {
						uni.showToast({
							title:"加载失败",
							icon:'none'
						})
					}
				})
			},
			//首页轮播图
			getIndexLunbo(){
				var _this = this;
				uni.request({
					url:this.$API.getIndexLunbo,
					method:"POST",
					header:this.$API.get_head(),
					success: (res) => {
						_this.IndexLunboArr = res.data.data;
					},
					fail: () => {
						uni.showToast({
							title:"加载失败",
							icon:'none'
						})
					}
				})
			},
			//轮播图上面的跳转
			Lunbogo(item){
				if(item.type=='goods'){
					uni.navigateTo({
						url:`/pages/shopPages/goods/detail/detail?id=`+item.to_page,
					})
				}else if(item.type=='news'){
					uni.navigateTo({
						url: '/pages/news/list2detail-detail?data=' + item.to_page
					})
				}
			},
			
			/**分类列表下的数据
			 * @param {Object} id 文章类别id
			 * @param {Object} j  文章类别列表索引
			 */
			lists_zxdetail(id,frist){
				//处理第一次 不选择类别
				if(frist){id = ''}
				var _this = this;
				_this.loadMoreStatus = true;
				uni.request({
					url:this.$API.ttNews_list,
					method:"GET",
					data:{
						page:_this.page,
						rows:_this.rows,
						where:{cat_id:id,status:1},
						sort : "is_top desc,publish_time",
						order : "desc"
					},
					header:this.$API.get_head(),
					success: (res) => {
						res.data.rows.forEach(function(v,i){
							v.tags?v.tags=v.tags.split(','):'';
						})
						_this.newspagelist =_this.newspagelist.concat(res.data.rows);
						_this.loadMoreStatus = false;
					},
					fail: () => {
						uni.showToast({
							title:"加载失败",
							icon:'none'
						})
						_this.loadMoreStatus = false;
					}
				})
			},
			//咨询分类列表
			list(){
				var _this = this;
				uni.request({
					url:this.$API.list,
					method:"GET",
					header:this.$API.get_head(),
					success: (res) => {
						_this.tabBars = res.data.rows;
						_this.lists_zxdetail(_this.tabBars[0].id,'frist')
					},
					fail: () => {
						uni.showToast({
							title:"加载失败",
							icon:'none'
						})
					}
				})
			},
			//咨询分类列表点击tab-bar
			tapTab(index,id) { 
				if (this.tabIndex === index) {
					return false;
				} else {
					this.newspagelist = [];
					this.page = 1;
					this.tabIndex = index;
					this.lists_zxdetail(id)
				}
			},
			upper: function(e) {
			    console.log(e)
			},
			lower: function(e) {
				this.page++;
				this.lists_zxdetail(this.tabBars[this.tabIndex].id)
			},
			scroll: function(e) {
				console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			kefu(){
				uni.switchTab({
				    url: '/pages/other/kefu/kefu'
				});
			},
			goapgece(){
				uni.switchTab({
				    url: '/pages/riskEvaluation/fengxianpingce'
				});
			},
			goapge(e){
				console.log(e)
				uni.navigateTo({
					url:e,
				})
			},
			sign(){
				uni.navigateTo({
					url:"/pages/newpages/qiandao"
				})
			},
			register2(){
				uni.navigateTo({
					url:"/pages/login/register2"
				})
			},
			//扫一扫
			scanCode(url){
				// #ifdef APP-PLUS
					/* 隐藏凸起图标 */
					var icon = plus.nativeObj.View.getViewById("icon");
					if(icon){icon.hide();}
				// #endif
				var _this = this;
				uni.scanCode({
				    success: function (res) {
						console.log(JSON.stringify(res))
						if(uni.getStorageSync("userid")){
							if(!_this.GetQueryString(res.result,'id')){
								return false;
							}
							uni.navigateTo({
								url:'/pages/huihuandeweizhi/fengxianxuncha?id='+_this.GetQueryString(res.result,'id')+'&position='+_this.GetQueryString(res.result,'position')
							})
						}else{
							plus.runtime.openURL(res.result)
						}
				    }
				});
			},
			//随手拍
			scanCode2(){
				// #ifdef APP-PLUS
					/* 隐藏凸起图标 */
					var icon = plus.nativeObj.View.getViewById("icon");
					if(icon){icon.hide();}
				// #endif
				// uni.scanCode({
				    // success: function (res) {
						// res.result = JSON.parse(res.result)
						uni.navigateTo({
							// url:'/pages/huihuandeweizhi/yinghuanshangchuan?id='+res.result.id+'&position = '+ res.result.position
							url:'/pages/companyYujing/list'
						})
				    // }
				// });
			},
			//获取地址参数
			GetQueryString(url,name) { 
			  var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			  url = url.slice(url.indexOf("?"));
			  var r = url.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
			  var context = ""; 
			  if (r != null) 
				 context = r[2]; 
			  reg = null; 
			  r = null; 
			  return context == null || context == "" || context == "undefined" ? "" : context; 
			},
			findCompanyInfo(){//查询企业信息验证是否第一次登陆
				var _this = this;
				uni.request({
					url:this.$API.findCompanyInfo,
					data:{
						type:2,
						userId:uni.getStorageSync("userid"),
					},
					method:"POST",
					header:this.$API.get_head(),
					success: (res) => {
						if(res.data==null||!res.data.faren||!res.data.faren||!res.data.tel||!res.data.address){
							_this.tancshow = true
						}
					}
				})
			},
			showtanc(){
				this.tancshow = false
			},
			changeSwiper(e){
				this.current = e.detail.current
			},
			//代办任务数量获取
			listByUser(){
				var _this = this;
				var reqdata = 
				uni.request({
					url:this.$API.listByUser,
					method:"POST",
					data:{
						userid: uni.getStorageSync("userid"),
						page: 1,
						rows: 2,
						status: 1
					},
					header:this.$API.get_head(),
					success: (res) => {
						_this.records = res.data.data.records;
						_this.recordslist = res.data.data.rows;
					}
				})
			},
			//待办详情
			toWarningDetail(id){
				uni.navigateTo({
					url: `../organization/finishTheTask?sspid=${id}`
				})
			},
			//待办列表
			toWarningList(){
				uni.navigateTo({
					url: '../huihuandeweizhi/fengxianyujing'
				})
			},
			//注销登录
			downline(){
				uni.removeStorageSync('userid');
				uni.removeStorageSync('deptid');
				uni.removeStorageSync('phone');
				uni.removeStorageSync('company');
				this.$appjs.jim.loginOut()
				// uni.reLaunch({
					// url:'/pages/login/login'
				// })	
			},
		}
	}

</script>

<style>
	@keyframes roll {
		form {
			transform: rotate(0deg);
		}

		to {
			transform: rotate(360deg);
		}
	}

	.shuiqiu {
		width: 126px;
		height: 126px;
		border-radius: 50%;
		position: relative;
		overflow: hidden;
	}

	.shuiqiucontent {
		width: 100%;
		height: 100%;
		position: relative;
		overflow: hidden;
		border-radius: 50%;
	}

	.shui {
		position: absolute;
		width: 1000px;
		height: 1000px;
		top: 126px;
		left: 50%;
		margin-left: -500px;
	}

	.shui1 {
		border-radius: 47.5%;
		background: #607d8bbe;
		animation: roll 10s linear infinite;
	}
	.shui1.red{background:#c8153f;}
	.shui1.blue{background:#3B81E3;}
	.shui1.yellow{background:#ffd300;}

	.shui2 {
		border-radius: 48%;
		background: #607d8b9a;
		animation: roll 14s linear infinite;
	}
	.shui2.red{background:#BC0A3E;}
	.shui2.blue{background:#3E83E5;}
	.shui2.yellow{background:#FCCE17;}

	.shui3 {
		border-radius: 48.5%;
		background: #607d8bab;
		animation: roll 12s linear infinite;
	}
	.shui3.red{background:#BC0D3E;}
	.shui3.blue{background:#3E86E8;}
	.shui3.yellow{background:#FACE17;}

	.shui4 {
		border-radius: 49%;
		background: #607d8b44;
		animation: roll 20s linear infinite;
	}
	.shui4.red{background:#BC083B;}
	.shui4.blue{background:#3E86EA;}
	.shui4.yellow{background:#F9CE17;}

	.shui5 {
		border-radius: 49.5%;
		background: #607d8b9f;
		animation: roll 16s linear infinite;
	}
	.shui5.red{background:#BB0D3E;}
	.shui5.blue{background:#3E83E3;}
	.shui5.yellow{background:#F7CE17;}

	.shui6 {
		border-radius: 50%;
		background: #607d8b38;
		animation: roll 19s linear infinite;
	}
	.shui6.red{background:#BB0A3B;}
	.shui6.blue{background:#367EE3;}
	.shui6.yellow{background:#F5CE17;}
</style>

<style lang="less">
	page{
		background: #F2F2F2;
		height:auto;
	}
	@keyframes myhide{
		from {top:0%;}
		to {top: 100%;}
	}
	@keyframes myshow{
		from {top: 100%;}
		to {top: 0%;}
	}
	.scroll-Y.show{
		animation: myshow 1s;
		top: 0%;
	}
	.scroll-Y.hide{
		animation: myhide 1s;
		top: 100%;
	}
	.he100{
		height:100%;
	}
	/*资讯*/
	.pages{
		width:100%;
		// height:100%;
		overflow: hidden;
	}
	.scroll-Y{
		height:100%;
		position:fixed;
		bottom: 0;
		top:100%;
		left: 0;
		right: 0;
		z-index: 9999;
		.scroll-Y-page{
			background:url(../../static/zixun/4.png) no-repeat;
			background-size:100% 100%;
			height:100%;
			
			/*轮播*/
			swiper {
				height: 300upx !important;
				margin: 0 30upx !important;
				border-radius: 10upx;
				padding: 0;
				image{
					width:100%;
					height: 300upx;
					border-radius: 10upx;
				}
			}
			.indicatorDots{
				display: flex;
				justify-content:center;
				margin: 20upx 0;
				padding: 0;
				.indicatorDotList{
					width:26upx;
					min-width: 26upx;
					height: 26upx;
					margin-right:18upx;
					image{
						width:26upx;
						height: 26upx;
					}
				}
				.indicatorDotList:last-child{
					margin-right:0upx;
				}
			}
		}
		.search{
			display: flex;
			margin:20upx 30upx;
			align-items: center;
			.back{
				width:24upx;
				min-height: 24upx;
				height:37upx;
				margin-right:20upx;
			}
			
			.searchBox{
				display: flex;
				width:100%;
				height:55upx;
				border-radius:10upx;
				background:#FFFFFF;
				align-items: center;
				justify-content: center;
				image{
					width:35upx;
					height:35upx;
					margin-right:20upx;
				}
				text{
					font-size:24upx;
					color:#828282;
				}
			}
			
		}
		.scrollbox{
			margin: 0 30upx;
			.uni-swiper-tab{
				border-bottom:0;
				.swiper-tab-list{
					width: auto;
					color:#FFFFFF;
					margin-right:67upx;
					font-size:27upx;
				}
				.active{
					color:#d7b262;
					font-size:37upx;
				}
			}
			
		}
	
		.news{
			background:#FFFFFF;
			.list{
				margin:30upx 30upx 0;
				display:flex;
				.listleft{
					width:100%;
					height:166upx;
					position: relative;
					.news_title{
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						overflow: hidden;
						font-size:27.7upx;
						color:#333333;
						font-weight:700;
					}
					.from{
						position: absolute;
						width: 100%;
						bottom: 0;
						display: flex;
						font-size:22upx;
						color:#666666;
						align-items:center;
						.fromtext{
							width:100%;
							overflow: hidden;
							text-overflow:ellipsis;
							white-space: nowrap;
						}
						.toptip{
							white-space: nowrap;
							margin-left:auto;
							background:#fcc4c4;
							color:#ff0000;
							padding:0upx 10upx;
							border-radius:10upx;
						}
						.sc{
							white-space: nowrap;
							margin-left:auto;
						}
					}
					
					.image{
						display: flex;
						margin: 20upx 0 0;
						justify-content:space-around;
						image{
							margin:0;
							margin-right: 10upx;
						}
						image:last-child{
							margin:0;
						}
					}
				}
				.listleft.hasimage{
					height:auto;
				}
				image{
					width:236upx;
					min-width:236upx;
					height: 166upx;
					border-radius:10upx;
					margin-left:20upx;
				}
			}
			.list:last-child{
				padding-bottom:30upx;
			}
		}
	}
	

</style>
<style>
	@-webkit-keyframes toFixed{
		from{opacity: 0;}
		to{opacity: 1;}
	}
	@-moz-keyframes toFixed{
		from{opacity: 0;}
		to{opacity: 1;}
	}
	@-o-keyframes toFixed{
		from{opacity: 0;}
		to{opacity: 1;}
	}
	@keyframes toFixed{
		from{opacity: 0;}
		to{opacity: 1;}
	}
	
	.card.second{
		position: relative;
		top:-150rpx;
		width: 90%;
		margin-left: 5%;
		/* padding: 40rpx; */
		border-radius:50rpx ;
	}
	
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
	}
	.status-bar {
		-webkit-animation: toFixed 0.2s;
		-moz-animation: toFixed 0.2s;
		-o-animation: toFixed 0.2s;
		-webkit-animation: toFixed 0.2s;
		height: var(--status-bar-height);
		width: 100%;
		background: #1E85E9;
		position: fixed;
		top: 0;
		left: 0;
		z-index: 999999;
	}
	.title{
		height:98upx;
		text-align: center;
		font-size:36upx;
		line-height:98upx;
		color: #333333;
		position:relative;
		z-index: 10;
	}
	.top{width:100%;
		/* background: #007AFF; */
		background: url(../../static/shouye/newHome/bg10.png);
		background-repeat:no-repeat ;
		
		background-size: 100% 100%;
		position:relative;
		height:636upx;
	}
	.bgtou{
		width:100%;
		height:600upx;
		position:absolute;
		z-index: -S1;
	}
	.duobianxing{
		width: 300rpx;
		height: 300rpx;
		background: url(../../static/shouye/newHome/duobianxing.png);
		background-size: 100% 100%;
		position: absolute;
		top: 125rpx;
		left: 225rpx;
		right: 0;
		bottom: 0;
		
	}
	.yuan{
		width: 230rpx;
		height: 230rpx;
		border-radius: 50%;
		position: absolute;
		top: 159rpx;
		left: 260rpx;
		right: 0;
		bottom: 0;
		/* background:#c8153f; */
		z-index: 2;
	}
	.backgrdRed{
		background:#c8153f;
	}
	.backgrdblue{
		background:#368ce6;
	}
	.backgrdyellow{
		background:#ffd300;
	}
	.yuan .num{
		position: absolute;
		color: #fff;
		font-size: 100upx;
		text-align: center;
		width: 100%;
		line-height: 200upx;
	}
	.fen{
		position: absolute;
		top: 320upx;
		right: 160upx;
		color: #fff;
		font-size: 20upx;
	}
	.fen0{
		position: absolute;
		top: 240upx;
		right: 280upx;
		color: #fff;
		font-size: 24upx;
		z-index: 5;
	}
	.fen1{
		position: absolute;
		top: 100upx;
		right: 430upx;
		color: #fff;
		font-size: 20upx;
	}
	.fen2{
		position: absolute;
		top: 320upx;
		right: 530upx;
		color: #fff;
		font-size: 20upx;
	}
	.zi{
		position: absolute;
		width: 100%;
		text-align: center;
		color: #fff;
		bottom: 290rpx;
		font-size: 23rpx;
		z-index: 3;
		
	}
	 .zi text{
		display: inline-block;
		border: 1upx solid #ab8374;
		padding: 8upx 10upx;
		border-radius: 20upx;
		line-height: 1;

	}
	
	.title .left{position:absolute;left:20upx;top:0;width:90upx;height:37upx;z-index: 11;}
	.title .left image{width:42upx;height:37upx;z-index: 12;}
	.title .left text{
		display: inline-block;
		width: 25upx;
		height: 25upx;
		border-radius: 50%;
		position: absolute;
		left: 50upx;
		top: -9upx;
		background: red;
		font-size: 15upx;
		color: #fff;
		line-height: 25upx;
		text-align: center;
		z-index: 13;
	}
	.title .right{position:absolute;right:20upx;top:0;width:39upx;height:39upx;}
	
	.card{background:#FFFFFF;margin-bottom:10upx;}
	.weiTitle{padding:8upx 24upx;width: 100%;box-sizing: border-box;}
	.weiTitle.fixed{position: fixed;top: var(--status-bar-height);left: 0;z-index: 9999;background: #fff;
	padding:20upx 24upx;-webkit-animation: toFixed 0.2s;-moz-animation: toFixed 0.2s;
	-o-animation: toFixed 0.2s;-webkit-animation: toFixed 0.2s;}
	.weiTitle text{color: #2892ff;font-size:36upx;padding-left: 20upx;border-left:12upx solid #2892ff;font-weight:bold;}
	.weiTitle image{width: 12upx;height:24upx;float: right;margin-top:22upx;}
	.row{margin:0 15upx;height: 100%;}
	.row>.list{display:flex;padding:12upx 25upx;border-bottom:1upx #ededed solid;}
	.row>.list>image{width:161upx;min-width:161upx;height: 101upx;margin-right:20upx;}
	.newTitle{color: #313131;font-size:28upx;overflow: hidden;white-space: nowrap;text-overflow:ellipsis;font-weight:bold;width:100%;}
	.newD{color:#707070;font-size:16upx;overflow: hidden;	text-overflow:ellipsis;width:100%;}
	
	.newCont{width:100%;}
	
	.swiper-item{display: flex;justify-content:flex-start;padding-top:10upx;}
	.swiper-item>view{width: 25%;position: relative;display: flex;flex-direction: column;justify-content: flex-end;}
	.swiper-item>view .num{
			display: inline-block;
			width: 25upx;
			height: 25upx;
			border-radius: 50%;
			position: absolute;
			left: 105upx;
			top: -9upx;
			background: red;
			font-size: 15upx;
			color: #fff;
			line-height: 25upx;
			text-align: center;
	}
	
	.swiper-item .text{text-align: center;color:#333333;font-size:20upx;font-weight: 600;margin-top:5upx;}
	.h60{display: flex;align-items: flex-end;position: relative;}
	.h60 image{margin: 0 auto;display: block;}
	.h60 .tag{position: absolute;top: -10upx;right: 46upx;color: #fff;background-color: red;font-size: 20upx;
	border-radius: 50%;width: 34upx;height: 34upx;padding: 2upx;line-height: 34upx;text-align: center;}
	swiper{height:145upx;padding:10upx 0 5upx;}
	.indicatorDots{display: flex;padding:0 0 5upx 0;justify-content: center;}
	.indicatorDots .Dot{width: 40upx;height: 10upx;background:#93c8ff;margin-right:12upx;border-radius:10upx;}
	.indicatorDots .Dot:last-child{margin-right:0;}
	.indicatorDots .Dot.active{background:#2892ff;}
	.daiban{display: flex;padding:5upx 5upx;align-items: center;position:relative;}
	.daiban .hu{width:85upx;height:85upx;min-width:85upx;min-height:85upx;margin-right:5upx;z-index: 4;}
	.daiban .hu2{width:55upx;height:55upx;min-width:55upx;min-height:55upx;margin-right:22upx;}
	.daiban .shixiang{
		width:100%;
		line-height:1.3;
		margin-top:10upx;
		display: flex;
		border-radius: 50upx;
	}
	
	.daiban .shixiang .list{
		width:600upx;
		font-size:20upx;
		color:#333333;
		overflow: hidden;
		text-overflow:ellipsis;
		white-space: nowrap;
		
	}
	.daiban .daiban_letfmore{width: 24upx;height: 30upx;position:absolute;top:0;right: 0;padding: 38upx 64upx 34upx 46upx;z-index: 5;}
	.daiban .shixiang swiper{
		height: 40upx;width: 720upx;background: rgb(233,239,255);position: relative;left:-130upx;z-index: 3;
		border-radius: 20upx;
		}
	.daiban .shixiang swiper swiper-item{height: 40upx;line-height: 40upx;overflow: hidden;}

	.tanc .mark{position:fixed;z-index:9998;top: 0;bottom: 0;left: 0;right:0;background:rgba(0,0,0,.6);}
	.tanc .tigBox{position:fixed;z-index:9999;top:0;bottom: 0;left: 0;right:0;width:570upx;margin: auto;height:620rpx;}
	.tanc .tigBox>image{width: 118upx;height:124upx;display:block;margin:0 auto 26upx;}
	.tanc .kuang{width: 570upx;height:328upx;background:url(../../static/cut/baikuang.png) no-repeat;background-size:100% 100%;}
	.tanc .kuang>view{padding:68upx 55upx;color:#FFFFFF;font-size: 24upx;}
	.btns{display: flex;justify-content: center;margin-top: 59upx;}
	.btns>image{height: 85upx;width: 274upx;}
	.btns>image:first-child{margin-right:23upx;}


/* //首页底部固定的条数新闻样式 */
	.row {
		margin: 0 15upx;
		height:668upx;
	}
	
	.row>.list {
		display: flex;
		padding: 30upx 25upx;
		border-bottom: 1upx #ededed solid;
	}
	
	.row>.list>image {
		width: 161upx;
		height: 101upx;
		margin-right: 30upx;
	}
	
	.newTitle {
		width: 420upx;
		color: #313131;
		font-size: 28upx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		font-weight: 700;
		
	}
	
	.newD {
		width: 420upx;
		color: #707070;
		font-size:24upx;
		line-height:1.2;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}
	/*弹窗*/
		.cgts{
			width: 100%;
			height: 100%;
			background: #007AFF;
			position: fixed;
			top:0;
			background: rgba(0,0,0,.5);
			z-index:99999;
		}
		.cgts>view{
			width: 460upx;
			height: 320upx;
			position: absolute;
			top: 50%;
			left: 50%;
			transform: translate(-50%,-50%);
			border-radius:10upx;
			background: #fff;
			box-sizing: border-box;
			padding:70upx 38upx;
			position:relative;
		}
		.cgts .close{
			position: absolute;
			right:10upx;
			top:-10upx;
		}
		.cgts .uni-icon.uni-icon-close{
			position: absolute;
			right:20upx;
			top:20upx;
		}
		.cgts text{
			font-size:30upx;
			font-family:Microsoft YaHei;
			font-weight:bold;
			text-align: center;
			display: block;
			width: 100%;
			margin-bottom: 45upx;
			color:rgba(66,66,66,1);
		}
		.cgts .buts{
			display: flex;
			justify-content: space-around ;
		}
		.cgts .buts button{
			width:170upx;
			font-size:28upx;
			display: inline-block;
		}
		.cgts .buts button:first-child{
			background-color:transparent;
			border:none;
			color: #D81E06;
		}
</style>